package com.banshou.installs.ui.adapter;

import android.content.Context;
import android.view.View;

import com.amap.api.services.core.PoiItem;
import com.banshou.installs.R;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;

import java.util.List;


/**
 * Created by cjq on 2018/1/5.
 * Email: stoic_yb@139.com
 * features:
 */

public class NearCommAdapter extends CommonAdapter<PoiItem> {

    private OnItemClickListener listener;

    public interface OnItemClickListener{
        void click(int position);
    }

    public void setOnItemCLickListene(OnItemClickListener listener){
        this.listener = listener;
    }

    public NearCommAdapter(Context context, int layoutId, List<PoiItem> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder holder, PoiItem poiItem, final int position) {
        holder.setText(R.id.address,mDatas.get(position).getTitle());
        holder.setOnClickListener(R.id.main, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.click(position);
            }
        });
    }
}
